<extend name="Public:header"/>
<block name="main-block">

    <img src="__PUBLIC__/home/img/newdar01.jpg" alt="" style="width:100%;">


        <!--注册真实账户-->

    <div class="register-body account-one">

        <div class="form" >

            <h2>注册真实账户</h2>

            <!--分三步 two  three 进行到第二步和第三步-->
            <dl class="">
                <dd class="dd1">账户信息</dd>
                <dd class="dd2">上传资料</dd>
                <dd class="dd3">注册成功</dd>
            </dl>


            <ul id="step1">
                <li>
                    <label class="control-label" for="input01">推荐人ID</label>
                    <input type="text" placeholder="介绍人的MT4 ID " id="input01" name="serverId">
                </li>
              <h3>个人信息</h3>
                <li>
                    <label class="control-label" for="input02">用户名</label>
                    <input type="text" placeholder=" " id="input02" name="userName">
                </li>
                <li>
                    <label class="control-label" for="input03">姓名</label>
                    <input type="text" placeholder="您的姓名 " id="input03" name="name">
                </li>
                <li>
                    <label class="control-label" for="input23">密码</label>
                    <input type="password" placeholder="密码 " id="input23" name="password">
                </li>

                <li>
                    <label class="control-label" for="input24">确认密码</label>
                    <input type="password" placeholder="确认密码 " id="input24" name="pass">
                </li>
                <li>
                    <label class="control-label" for="input04">性别</label>
                    <label class="radio"><input type="radio" value="2" name="sex" checked>男</label>
                    <label class="radio"><input type="radio" value="3" name="sex" >女</label>
                </li>

                <h3>账户信息</h3>
                <li>
                    <label class="control-label" for="input07">点差</label>
                    <label class="radio"><input type="radio" value="e" name="dot" checked>ecn</label>
                    <label class="radio"><input type="radio" value="s" name="dot" >stp</label>
                </li>
                <li>
                    <label class="control-label" for="input08">杠杆</label>
                    <input type="text" placeholder=" " id="input08" name="leaverage">
                </li>

                <li>
                    <label class="control-label" for="input09">手续费</label>
                    <input type="text" placeholder="100" id="input09" name="commission" value="100" readonly>
                </li>
                <h3>联系信息</h3>
                <li>
                    <label class="control-label" for="input05">电话</label>
                    <input type="text" placeholder="您的联系方式 " id="input05" name="tel">
                </li>
                <li>
                    <label class="control-label" for="input06">Email</label>
                    <input type="text" placeholder="您的邮箱 " id="input06" name="email">
                </li>
                <li>
                    <label class="control-label" for="input010">地址</label>
                    <input type="text" placeholder="您的居住地址 " id="input010" name="add">
                </li>
                <li>
                    <label class="control-label" for="input011">城市</label>
                    <input type="text" placeholder="您所在城市 " id="input011" name="city">
                </li>
                <li>
                    <label class="control-label" for="input012">省份</label>
                    <input type="text" placeholder=" " id="input012" name="province">
                </li>
                <li>
                    <label class="control-label" for="input013">国家</label>
                    <input type="text" placeholder="您的国籍 " id="input013" name="country">
                </li>
                <li>
                    <label class="control-label" for="input014">身份证号</label>
                    <input type="text" placeholder="身份证号" id="input014" name="idCardNo">
                </li>
                <h3>接受条款及协议</h3>
                <li class="terms">
                    <span class="radio"><input type="radio" value="1" name="Agreement1" ><a href="" target="_blank">用户协议</a></span>
                    <span class="radio"><input type="radio" value="1" name="Agreement2" ><a href="" target="_blank">反洗钱协议</a></span>
                </li>
                <li class="last">
                    <input type="button" value="下一步">
                    <p class="warning">请完善信息！</p>
                </li>

            </ul>


        </div>

    </div>

        <!--注册真实账户-->

        <!--证件照-->
    <div class="Management-title">


                <div class="Management-change">


                            <div class="show3">
                                <ul>
                                    <li class="li1">
                                        <h2 style="width:178px;">手持正面证件照片：</h2>
								<span>
                                    <table>
                                        <tr>
                                            <td align="center" height="120"><img src="__PUBLIC__/Home/img/id-card1.jpg" alt="artwe" id="iden"></td>
                                        </tr>
                                    </table>
                                </span>
                                        <h2>　范例：</h2>
                                        <img src="__PUBLIC__/Home/img/exp_01.jpg" alt="artwe" id="exp">
                                        <a class="btn" id="btn-iden-one">上传</a>
                                    </li>
                                    <li class="li2">
                                        <h2 style="width:178px;">证件正面照片：</h2>
								<span>
                                    <table>
                                        <tr>
                                            <td align="center" height="120"><img src="__PUBLIC__/Home/img/id-card1.jpg" alt="artwe" id="iden"></td>
                                        </tr>
                                    </table>
                                </span>
                                        <h2>　范例：</h2>
                                        <img src="__PUBLIC__/Home/img/exp_02.jpg" alt="artwe" id="exp">
                                        <a class="btn" id="btn-iden-two">上传</a>
                                    </li>

                                    <input type="button" value="保 存" class="save" onclick="accountone()">

                                </ul>

                            </div>


                </div>


            </div>
        <!--证件照-->



        <div class="c-layout-go2top">
            <i class="icon-arrow-up"></i>
        </div>

        <script type="text/javascript" src="__PUBLIC__/Home/js/plupload.full.min.js"></script>

        <script type="text/javascript">

            var more_array = new Array();

            var uploaderAll = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'btn-iden-two', // 上传按钮
                url: "__APP__/home/RegisterM/upload",
                flash_swf_url: 'plupload/Moxie.swf',
                silverlight_xap_url: 'plupload/Moxie.xap',
                filters: {
                    max_file_size: '1500kb',
                    mime_types: [
                        {title: "files", extensions: "jpg,png,gif"}
                    ],
                    prevent_duplicates : true, //不允许选取重复文件
                },
//                resize: {width: 600, height: 600, quality: 90},
                multi_selection: true, //true:ctrl多文件上传, false 单文件上传
                init: {
                    FilesAdded: function (up, files) { //文件上传前
                        if ($("#ul_pics").children("li").length > 2) {
                            alert("您上传的图片太多了！");
                            uploaderAll.destroy();
                        } else {
                            var li = '';
                            plupload.each(files, function (file) { //遍历文件
                                li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div>";
                            });
                            $("#ul_pics").append(li);
                            uploaderAll.start();
                        }
                    },
                    UploadProgress: function (up, file) { //上传中，显示进度条
                        var percent = file.percent;
                        $("#" + file.id).find('.bar').css({"width": percent + "%"});
                        $("#" + file.id).find(".percent").text(percent + "%");
                    },
                    FileUploaded: function (up, file, info) { //文件上传成功的时候触发
                        var data = eval("(" + info.response + ")");
                        $(".Management-title .Management-change .show3 ul li.li2").find("img#iden").attr({"src":'__APP__' + data.pic})
                        idimg2 = data.pic;
                    },
                    Error: function (up, err) { //上传出错的时候触发
                        // alert(err.message);
                        alert("图片过大！");
                    }
                }
            });
            uploaderAll.init();


            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'btn-iden-one', 						//触发文件选择对话框的按钮，为那个元素id
                url: "__APP__/home/RegisterM/upload",
                flash_swf_url: 'plupload/Moxie.swf',
                silverlight_xap_url: 'plupload/Moxie.xap',
                filters: {
                    max_file_size: '500kb',
                    mime_types: [
                        {title: "files", extensions: "jpg,png,gif"}
                    ]
                },
                multi_selection: false, //true:ctrl多文件上传, false 单文件上传
                init: {
                    FilesAdded: function(up, files) { //文件上传前
                        if ($("#ul_pics").children("li").length > 1) {
                            alert("您上传的图片太多了！");
                            uploader.destroy();
                        } else {
                            var li = '';
                            plupload.each(files, function(file) { //遍历文件
                                li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div></li>";
                            });
                            $("#ul_pics").append(li);
                            uploader.start();
                        }
                    },
                    UploadProgress: function(up, file) { //上传中，显示进度条
                        var percent = file.percent;
                        $("#" + file.id).find('.bar').css({"width": percent + "%"});
                        $("#" + file.id).find(".percent").text(percent + "%");

                    },


                    FileUploaded: function(up, file, info) { //文件上传成功的时候触发

                        var data = eval("(" + info.response + ")");
                        $(".Management-title .Management-change .show3 ul li.li1").find("img#iden").attr({"src":'__APP__' + data.pic});
                        idimg1 = data.pic;
                    },
                    Error: function(up, err) { //上传出错的时候触发
                        alert(err.message);
                    }
                }
            });
            uploader.init();


            function  accountone(){

            console.log(serverId);
            console.log(userName);
            console.log(name);
            console.log(password);
            console.log(pass);
            console.log(sex);
            console.log(dot);
            console.log(leaverage);
            console.log(commission);
            console.log(tel);
            console.log(email);
            console.log(add);
            console.log(city);
            console.log(province);
            console.log(country);
            console.log(idCardNo);
            console.log(idimg1);
            console.log(idimg2);



            //$(".register-body .form dl").addClass("three"); 成功
                $.ajax({
                    type : "post",
                    url : "__APP__/Home/Register/register",
                    dataType : 'json',
                    data:{
                        serverId:serverId,
                        userName:userName,
                        name:name,
                        sex:sex,
                        dot:dot,
                        leaverage:leaverage,
                        commission:commission,
                        tel:tel,
                        email:email,
                        front:idimg1,
                        reverse:idimg2,
                        address:add,
                        city:city,
                        province:province,
                        country:country,
                        password:password,
                        idCardNo:idCardNo,
                        language:'CN',

                    },
                    success : function (data)
                    {
                        if (data.info == 1) {
//                            alert('成功');
                            $(".register-body .form dl").addClass("three");
                             location.href = "__APP__/index";
                        }else if(data.info == -1){
                            alert('验证失败');
                        }else if(data.info == -2){
                            alert('创建失败');
                        }
                    }
                });

                $.ajax({
                    type : "post",
                    url : "http://my.newdarfx.com:8080/External/AddBroker",
                    dataType : 'json',
                    data:{
                        serverId:serverId,
                        userName:userName,
                        name:name,
                        sex:sex,
                        dot:dot,
                        tel:tel,
                        email:email,
                        front:idimg1,
                        reverse:idimg2,
                        add:add,
                        city:city,
                        province:province,
                        country:country,
                        password:password,
                        idCardNo:idCardNo,
                        language:'zh-cn',
                    },
                    success : function (data)
                    {
                        if (data.state == 'true') {
                            alert('成功');
                        }else if(data.state == 'false'){
                            alert('验证失败');
                        }
                    }
                });
        }



       </script>


</block>